<%@ page language="java" contentType="text/html; charset=utf-8" isELIgnored="false"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="${pageContext.request.contextPath}/fare/lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link rev="stylesheet" media="all" href="${pageContext.request.contextPath}/fare/css/form_style.css" type="text/css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  	
<title>城市管理</title>
<jsp:include page="/fare/cityManage/right_head.jsp"></jsp:include>
<script type="text/javascript">
/* function addToolBar() {
	$("#toptoolbar").ligerToolBar({
		items :[ {
			text : '增加城市子节点',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/add.png",
			click : function(item) {
				location.href = '${pageContext.request.contextPath}/cityManage/toEditCity.action?cityVO.pid=${vo.mid}'; 
			}
		},
		{
			line : true
		}, {
			text : '增加机场子节点',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				location.href = '${pageContext.request.contextPath}/cityManage/toEditPort.action?vo.portEntity.cityId=${vo.mid}'; 
				
			}
		}, 
		<c:if test="${vo.mid ne 'CITY_TREE' }">
		{
			line : true
		}, {
			text : '删除',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_delete.gif",
			click :  function(item) {
				if(confirm("你的操作将无法恢复，确定删除该节点及该节点下的子节点？")){
				$.ajax({
					type: "post",
					url: "${pageContext.request.contextPath}/cityManage/delete.action?vo.mid=${vo.mid}",
					dataType: "json",
					success: function(resultData){
						alert(resultData);
					},
					error : function(message) {
						alert("系统出现异常。");
					}
				});
			}
			}
		}, 
		</c:if>
		{
			line : true
		}, {
			text : '创建选择框数据',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				createScript();
				createSingleScript();
			}
		}, 
		//{
			//line : true
		//}, {
			//text : '创建8个航空公司选择框数据 ',
			//img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			//click :  function(item) {
				//createSingleScript();
			//}
		//}, 
		{
			line : true
		} ]
	});
} */

/* createScript();">创建super用户城市选择框数据
createSingleScript();">创建8个航空公司选择框数据 */

$(function (){
 //	addToolBar();
//	parent.closeWaiting();
	
	var message = '${vo.message}';
	if(message!=''){
		alert(message);
	}
});


function submitForm(){
	if($("#form1").valid()){
		document.forms[0].submit();
	}
}


function createScript(){
	$.ajax({
		   type: "POST",
		   url: "createCityScriptAction!getAllCityInfo.action",
		   dataType:"text",
		   success: function(msg){
		     alert(msg);
		   }
		});
}
function createSingleScript(){
	var item = $("input[name='sourceId']:checked").val();
/* 	if(typeof(item) == "undefined"){
		alert("请选择航空公司!");
	}else{ */
		$.ajax({
			   type: "POST",
			   url: "createCityScriptAction!getCityInfoByCompany.action",
			   data: "sourceId="+item,
			   dataType:"text",
			   success: function(msg){
				   alert(msg);
			   }
		});
	/* } */
	
}

function ajaxSubmit(){
	var data= $("#form1").serialize();
	var url="${pageContext.request.contextPath}/cityManage/saveCity.action";
	 $.ajax({
			url:url,
			type : "POST",
			cache : false, 
			data: data,
			async : true,
			dataType:'html',
			success:function(data){
		    	 alert("保存成功！");
		    	 parent.grid.loadData();
		   		 parent.dlog.close();
			   },
			  error:function(){ 
			    alert("请先登录");
			   },
	 });
	
	
}

</script>


</head>
<body>
<form id="form1" action="${pageContext.request.contextPath}/cityManage/saveCity.action" method="post">

	<div class="l-topmenu-index">
		<div id="toptoolbar"></div>
	</div>
	<div class="form_table_tltle">城市信息设置 </div>
             <ul id="errorlist"></ul>
             	<input type="hidden" name="cityVO.id" value="${cityVO.id}"/>
                 <table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table">
                       <tbody>
                     
	                   	 <tr>
	                         <td align="right" class="left"  valign="middle">父级城市id&nbsp;</td>
	                         <td>
	                           <input disabled class="input_205 input_txt cname" id="cityCode" name="pid" value="${cityVO.pid}" size="20"  type="text">
	                           	<input type="hidden" name="cityVO.pid" value="${cityVO.pid}"/>
	                         </td>
	                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
	                     </tr>
                     
                     <tr>
                         <td align="right" class="left"  valign="middle">编码&nbsp;</td>
                         <td>
                           <input validate=":required; :min_length;2" class="input_205 input_txt cname" id="cityCode" name="cityVO.code" value="${cityVO.code}" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                      <tr>
                         <td align="right" class="left"  valign="middle">名称&nbsp;</td>
                         <td>
                           <input onchange="$('#sortCityText').text(this.value);" validate=":required; :min_length;2 :max_length;100" class="input_205 input_txt cname" id="cityName" maxlength="20" minlength="3"  name="cityVO.name" value="${cityVO.name}" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                      <tr>
                         <td align="right" class="left"  valign="middle">别名&nbsp;</td>
                         <td>
                           <input validate=":required; :min_length;2" class="input_205 input_txt cname" id="aliasName" name="cityVO.aliasName" value="${cityVO.aliasName}" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     
                      <tr>
                         <td align="right" class="left"  valign="middle">英文名称&nbsp;</td>
                         <td>
                           <input validate=":min_length;2 :max_length;100" class="input_205 input_txt cname" id="nameSpell"  name="cityVO.nameSpell" value="${cityVO.nameSpell }" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                      <tr>
                         <td align="right" class="left"  valign="middle">英文简称&nbsp;</td>
                         <td>
                           <input validate=":min_length;2 :max_length;100" class="input_205 input_txt cname" id="nameSpellInitials" name="cityVO.nameSpellInitials" value="${cityVO.nameSpellInitials }" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                       <tr>
                         <td align="right" class="left"  valign="middle">热门等级&nbsp;</td>
                         <td>
                           <input  class="input_205 input_txt cname" id="hotLevel" name="cityVO.hotLevel" value="${cityVO.hotLevel }" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                    
                <tr>
					<td align="right" class="left" valign="middle">排序号：</td>
					<td ><input name="cityVO.treeSort"
						 type="text" id="txtName" ltype="text"
						value="${cityVO.treeSort }"
						validate=":required;:min_length;1;:maxlength:10;:number;" /></td></td>
					<td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
				</tr>
				
                 </tbody></table>
			<div  align="center"><input class="l-button l-button-submit"  type="button" name="submit" id="btn_save" onclick="javascript:ajaxSubmit();" value="保存" /></div>
</form>

</body>
</html>